package oop.ex2.enums;

import java.util.regex.Pattern;

public enum VariableEnum {
    STRING( "\\s*(String)\\s+([A-Za-z]+\\w*|_+[A-Za-z0-9]+)(.*);\\s*$"),
    INT("\\s*(int)"+STRING.getCommonRegex()),
    DOUBLE("\\s*(double)"+STRING.getCommonRegex()),
    BOOLEAN("\\s*(boolean)"+STRING.getCommonRegex()),
    CHAR("\\s*(char)"+STRING.getCommonRegex()),
    INSERTION("\\s*(\\w+)\\s*=(.+);\\s*$"),
    FINAL("\\s*(final).*");    


    private String commonRegex;
    private Pattern enumPattern;

    private VariableEnum(String regex) {
        commonRegex = "\\s+([A-Za-z]+\\w*|_+[A-Za-z0-9]+)(.*);\\s*$";
        enumPattern = Pattern.compile(regex);
    }

    public Pattern getEnumPattern() {
        return enumPattern;
    }
    
    public String getCommonRegex() {
        return commonRegex;
    }
}
